/* 移入事件 */
var catalog = document.getElementById("catalog");

var allMoves = document.getElementsByClassName("move");

for (var i = 0; i < allMoves.length; i++) {
    allMoves[i].onmouseover = function () {
        this.lastElementChild.style.display = "block";
        var moveIndex = getIndex(this)
        changePStyleByIndex(moveIndex);
        allMoves[moveIndex].firstElementChild.className = "after active";
        allMoves[2].firstElementChild.className = "after active";
    }
    allMoves[i].onmouseout = function () {
        this.lastElementChild.style.display = "none";
        var moveIndex = getIndex(this);
        allMoves[moveIndex].firstElementChild.className = "after";
        allMoves[2].firstElementChild.className = "after active"
    }

}


function getIndex(t){
    for(var i = 0;i<allMoves.length;i++){
        var index = -1;
        if(allMoves[i]==t){
            index = i;
            break;
        }
    }return index;
}



function changePStyleByIndex(n){
    for(var i = 0;i < allMoves.length;i++){
        if(i == n){
            allMoves[i].firstElementChild.className = "after active";
        }else{
            allMoves[i].firstElementChild.className = "after";
        }
        allMoves[2].firstElementChild.className = "after active"
    }
}


var address = document.getElementById("address")
var address1 = address.getElementsByClassName("address")
address.onmousemove = function(){
    address.lastElementChild.style.display = "block";
    address1[0].firstElementChild.style.borderTop = "8px solid #059FFF"
}
address.onmouseout = function(){
    address.lastElementChild.style.display = "none";
    address1[0].firstElementChild.style.borderTop = "8px solid white"
}



var ywQuestion = document.getElementById("ywQuestion");

var allLis = ywQuestion.getElementsByTagName("li");

for (var i = 0; i < allLis.length; i++) {
    allLis[i].onmouseover = function () {
        this.lastElementChild.firstElementChild.style.color = "#14A2FF";

    }
    allLis[i].onmouseout = function () {
        this.lastElementChild.firstElementChild.style.color = "#333333";
    }
}



var weixin = document.getElementsByClassName("weixin");
weixin[0].onmousemove = function(){
    weixin[0].lastElementChild.style.display = "block";
}
weixin[0].onmouseout = function(){
  weixin[0].lastElementChild.style.display = "none";
}


var allConsult = document.getElementsByClassName("allConsult");
var allliis = allConsult[0].getElementsByTagName("li");

allliis[0].onmousemove = function(){
    allliis[0].firstElementChild.firstElementChild.src = "..\\cuds\\images\\qq1.png";
    allliis[0].className = "qq active1"
    allliis[0].lastElementChild.style.display = "block"
}
allliis[0].onmouseout = function(){
    allliis[0].firstElementChild.firstElementChild.src = "..\\cuds\\images\\qq.png";
    allliis[0].className = "qq";
    allliis[0].lastElementChild.style.display = "none"
}
allliis[1].onmousemove = function(){
    allliis[1].firstElementChild.firstElementChild.src = "..\\cuds\\images\\wechat1.png";
    allliis[1].className = "weixin1 active1"
    allliis[1].lastElementChild.style.display = "block"
}
allliis[1].onmouseout = function(){
    allliis[1].firstElementChild.firstElementChild.src = "..\\cuds\\images\\wechat.png";
    allliis[1].className = "weixin1";
    allliis[1].lastElementChild.style.display = "none"
}
allliis[2].onmousemove = function(){
    allliis[2].firstElementChild.firstElementChild.src = "..\\cuds\\images\\tel1.png";
    allliis[2].className = "tel active1"
    allliis[2].lastElementChild.style.display = "block"
}
allliis[2].onmouseout = function(){
    allliis[2].firstElementChild.firstElementChild.src = "..\\cuds\\images\\tel.png";
    allliis[2].className = "tel";
    allliis[2].lastElementChild.style.display = "none"
}

var ScrollUp = document.getElementById("ScrollUp");

window.onscroll =function(){
    var top = document.documentElement.scrollTop||document.body.scrollTop;
    if(top > 50){
        ScrollUp.style.visibility="visible"
    }else{
        ScrollUp.style.visibility="hidden"
    }
}
ScrollUp.onclick = function(){
    window.scrollTo({top:0, behavior: "smooth"})
}